package byf;

import java.lang.reflect.Method;

public class byf {
    public static void main(String args[])throws Exception{
        User u=new User();
        u.setName("byf");
        System.out.println(u.getName());
        Class<?> UU=Class.forName("byf.User");
        Object o=UU.newInstance();

        Method setName = UU.getMethod("setName",String.class);
        setName.invoke(o,"Jenkins");
        
       Method getName= UU.getMethod("getName");
       Object result = getName.invoke(o);
       System.out.println(result);

       User u1=new User();
       u.setAge("20");
       System.out.println(u.getAge());

        Method setAge = UU.getMethod("setAge",String.class);
        setAge.invoke(o,"20");

        Method getAge= UU.getMethod("getAge");
        Object result1 = getAge.invoke(o);
        System.out.println(result1);

    }
}
